/**
 * ListTile
 */
import 'package:flutter/material.dart';

class ListTileComp extends StatefulWidget {
  const ListTileComp({Key? key}) : super(key: key);

  @override
  State<StatefulWidget> createState() {
    return new MyCardState();
  }
}

class MyCardState extends State<ListTileComp> {
  var _throwShotAway = false;

  @override
  Widget build(BuildContext context) {
    return new Card(
      child: new ListTile(
          title: new Text("duo_shine"),
          subtitle: new Text("duo_shine@163.com"),
          //之前显示icon
          leading: Icon(Icons.email, color: _throwShotAway ? Colors.blueAccent : Colors.redAccent),
          //之后显示checkBox
          trailing: new Checkbox(
              value: _throwShotAway,
              onChanged: (bool? newValue) {
                setState(() {
                  _throwShotAway = newValue!;
                });
              })),
    );
  }
}